package com.lemonfish.pojo.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
import java.util.List;

/**
 * 商品分类 Entity定义
 *
 * @author Lemonfish
 * @version 1.0
 * @date 2020-03-07
 * Copyright © Chao Zhang
 */
@ApiModel(value = "商品分类")
@Getter
@Setter
@Accessors(chain = true)
public class GoodsCate extends BaseCustomEntity {

    private static final long serialVersionUID = -181348237808855106L;

    // 分类名称
    @ApiModelProperty(value = "分类名称", example = "")
    @Length(max = 30, message = "分类名称长度应小于30")
    @TableField()
    private String name;

    // 等级
    @ApiModelProperty(value = "等级", example = "")
    @TableField()
    private Integer level;

    // 父类id
    @ApiModelProperty(value = "父类id", example = "")
    @TableField()
    private Long parentId;

    // 更新时间
    @ApiModelProperty(value = "更新时间", example = "2020-03-08 07:27")
    @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NOT_NULL)
    private Date updateTime;

    @TableField(exist = false)
    private List<GoodsCate> children;
}
